﻿using System;
using System.Text;
using System.Data;

namespace LKCMS.Web
{
    public partial class Note : System.Web.UI.UserControl
    {
      
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                StringBuilder sb = new StringBuilder();

                LKCMS.BLL.Article abll = new LKCMS.BLL.Article();
                LKCMS.BLL.Channel cbll = new LKCMS.BLL.Channel();
                DataTable dt = cbll.GetList(29);
                sb.Append("<div id=\"note\">");
                for (int j = 0; j < dt.Rows.Count; j++)
                {
                    DataTable dt1 = abll.GetPageList(4, 0, " ClassId=" + dt.Rows[j]["ID"].ToString(), "AddTime desc").Tables[0];
                    string s = string.Empty;
                    switch (j)
                    {
                        case 0:
                            s = "a";
                            break;
                        case 1:
                            s = "b";
                            break;
                        case 2:
                            s = "c";
                            break;
                        case 3:
                            s = "d";
                            break;
                        case 4:
                            s = "f";
                            break;
                    }
                    sb.Append("<ul id=\"note_ul\">");
                    sb.Append("<li class=\"note_li\">" + dt.Rows[j]["Title"] + "</li>");
                    for (int i = 0; i < dt1.Rows.Count; i++)
                    {
                        sb.Append("<li><a href=\"help.aspx#" + s + "" + (i + 1) + "\">" + dt1.Rows[i]["Title"] + "</a></li>");
                    }
                    sb.Append("</ul>");
                }
                sb.Append("</div>");
                this.LiteralNote.Text = sb.ToString();
            }

        }
    }
}